package com.car.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class EmojiFilterUtils {

    public static String filterEmoji(String text) {

        Pattern emoji = Pattern . compile (

            "[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]" ,

            Pattern . UNICODE_CASE | Pattern . CASE_INSENSITIVE ) ;
        Matcher emojiMatcher = emoji . matcher ( text ) ;

        if ( emojiMatcher . find ( ) ) {

          return "" ;

        }
		return text;
      
   } 

    public static void main(String[] arg ){
        try{
            String text = "This is a smiley \uD83C\uDFA6 face\uD860\uDD5D \uD860\uDE07 \uD860\uDEE2 \uD863\uDCCA \uD863\uDCCD \uD863\uDCD2 \uD867\uDD98 ";
            System.out.println(filterEmoji(text));
        }catch (Exception ex){
            ex.printStackTrace();
        }
    }
}